// Mock for NativeModules
jest.mock('react-native', () => {
  const RN = jest.requireActual('react-native');

  RN.NativeModules.DlnaPlayer = {
    // 模拟所有原生模块方法
    searchDevices: jest.fn(() => Promise.resolve([])),
    connectToDevice: jest.fn(() => Promise.resolve(true)),
    disconnectFromDevice: jest.fn(() => Promise.resolve(true)),
    playVideo: jest.fn(() => Promise.resolve(true)),
    pauseVideo: jest.fn(() => Promise.resolve(true)),
    resumeVideo: jest.fn(() => Promise.resolve(true)),
    stopVideo: jest.fn(() => Promise.resolve(true)),
    seekTo: jest.fn(() => Promise.resolve(true)),
    getPlaybackStatus: jest.fn(() => Promise.resolve({
      isPlaying: false,
      position: 0,
      duration: 0,
      isBuffering: false,
      isCompleted: false,
      isError: false
    })),
    setVolume: jest.fn(() => Promise.resolve(true)),
    getVolume: jest.fn(() => Promise.resolve(50)),
    setMute: jest.fn(() => Promise.resolve(true)),
    getMute: jest.fn(() => Promise.resolve(false)),
    checkPermissions: jest.fn(() => Promise.resolve({ hasPermissions: true })),
    requestPermissions: jest.fn(() => Promise.resolve(true)),
    addListener: jest.fn(),
    removeListeners: jest.fn(),
    
    // 旧版API（为了向后兼容）
    search: jest.fn(() => Promise.resolve()),
    start: jest.fn(() => Promise.resolve()),
    stop: jest.fn(() => Promise.resolve()),
    pause: jest.fn(() => Promise.resolve()),
    play: jest.fn(() => Promise.resolve()),
    seek: jest.fn(() => Promise.resolve()),
    getPosition: jest.fn(() => Promise.resolve(0)),
    getDuration: jest.fn(() => Promise.resolve(0)),
  };

  return RN;
}); 